<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="test">
        <input type="button" value="v-on指令" v-on:click="doit">
        <input type="button" value="v-on简写" @click="doit">
        <input type="button" value="双击事件" v-on:dblclick="doit">
        <h2 v-on:click="changeName">{{ name }}</h2>
    </div>
</body>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script>
    var demo = new Vue({
        el:"#test",
        data:{
            name:"Gnar"
        },
        methods:{
            doit:function(){
                alert("do sth!");
            },
            changeName:function(){
                // alert(this.name);
                this.name+="哒哒!~";
            }
        },
    })
</script>
</html>